package com.xqboss.apps.dto.order;

import com.xqboss.apps.enums.nft.NftTypeEnum;
import com.xqboss.apps.enums.order.OrderTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Objects;

/**
 * <p>
 *     获取订单统计信息参数
 * </p>
 * @author Trent
 * @date 2023/8/24
 */
@Data
@ApiModel
public class OrderStatisticsDto {

    @ApiModelProperty("订单类型")
    private OrderTypeEnum orderType;
    @ApiModelProperty("藏品类型, 仅对")
    private NftTypeEnum nftType;
    @ApiModelProperty("开始时间")
    private LocalDateTime createTimeStart;
    @ApiModelProperty("结束时间")
    private LocalDateTime createTimeEnd;
    @ApiModelProperty("商品ID")
    private Long spuId;

    public LocalDateTime getCreateTimeEnd() {
        if(Objects.nonNull(createTimeEnd)){
            return createTimeEnd.with(LocalTime.MAX);
        }
        return createTimeEnd;
    }
}
